<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<!-- 顶部导航 start-->
	<div id="menu">
		<ul>
			<a href="">首页</a>
			<a href="<?php echo __WEB__?>?a=category&c=Index&m=Home&id=5">汽车</a>
			<a href="<?php echo __WEB__?>?a=category&c=Index&m=Home&id=7">智能手机</a>
			<a href="<?php echo __WEB__?>?a=category&c=Index&m=Home&id=12">PHP</a>
		</ul>
	</div>
	<!-- 顶部导航 end-->
	<!--主体 start-->
	<div id="box">
		    <?php
        $cid = "12";
        $db = Db::table('article');
        if($cid)
        {
            $data = $db->whereIn('cid',explode(',',$cid))->limit(3)->get();
        }
        else
        {
            $data = $db->limit(3)->get();
        }

        foreach($data as $field):
            $field['title']=mb_substr($field['title'], 0,6,'utf8');
            $field['url']=U('Home/Index/article',array('id'=>$field['id']));
        ?>
        
			<a href="<?php echo $field['url']?>"><?php echo $field['title']?></a><br/>
		
        <?php 
        endforeach;
        ?>
	</div>
	<!--主体 end-->
	<!--底部 start-->
	<div id="foot">
		
	</div>
	<!--底部 end-->
</body>
</html>













